import { onMounted, onUnmounted } from 'vue'

export const useEvent = (target, eventName, cb) => {
  onMounted(() => target.addEventListener(eventName, cb))
  onUnmounted(() => target.removeEventListener(eventName, cb))
}
